package com.example.airtest.ui;


import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.example.airtest.R;
import com.example.airtest.ui.state.MainViewModel;
import com.fandou.airobot.AiRobotActivity;
import com.fandou.airobot.BR;
import com.fandou.base.ui.DataBindingConfig;
import com.fandou.base.ui.fragment.BaseFragment;
import com.google.android.material.shape.MaterialShapeDrawable;
import com.google.android.material.shape.ShapeAppearanceModel;

/**
 * @author Jm
 * @date 2020/7/3 16:28
 * @description
 */
public class MainFragment extends BaseFragment {

    private MainViewModel mMainViewModel;

    @Override
    protected void initViewModel() {
        mMainViewModel = getFragmentViewModel(MainViewModel.class);
    }

    @Override
    protected DataBindingConfig getDataBindingConfig() {
        return new DataBindingConfig(R.layout.fragment_main, mMainViewModel)
                .addBindingParam(BR.click, new ClickProxy());
    }

    ImageView ivTest;

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
         ivTest = view.findViewById(R.id.ivTest);

    }

    public class ClickProxy {

        /**
         * 点击进入ai学伴
         */
        public void toAiRobot() {
//            MaterialShapeDrawable drawable = new MaterialShapeDrawable(ShapeAppearanceModel.builder(mContext, R.style.Test,0).build());
//            drawable.setInterpolation(1);
//            ivTest.setImageDrawable(drawable);
            AiRobotActivity.Companion.start(mContext);
        }
    }

}
